//
// Created by 15548 on 2025/3/28.
//

#ifndef CHESSBOTBOARD_22_SCREEN_H
#define CHESSBOTBOARD_22_SCREEN_H
#include <ui.h>
// 添加全局颜色常量，避免重复调用 lv_color_hex
const lv_color_t COLOR_GOLD    = lv_color_hex(0xFFD700);
const lv_color_t COLOR_RED     = lv_color_hex(0xFF0000);
const lv_color_t COLOR_ORANGE  = lv_color_hex(0xFFA500);
const lv_color_t COLOR_GREEN   = lv_color_hex(0x0bbc39);

void screen_init();
inline static void update_list_outline(lv_obj_t *list, int selectedIndex, int totalItems, lv_color_t outline_color);
int update_index(int current, int delta, int min_val, int max_val, lv_scr_load_anim_t &anim, bool forward);
void processMain1(); // 删除参数 int data[]
void processSettingsBasic(); // 删除参数 int data[]
void processMode();
void processLevel();
void processError();
void processSettingsSubmenuToggle(); // 删除参数 int data[]
void update_voice_state(bool enabled);
void processSettingsAdjustments(); // 删除参数 int data[]
inline static void set_parent_if_not_null(lv_obj_t *obj, lv_obj_t *parent);
inline static void set_visibility(lv_obj_t *obj, bool visible);
static void set_common_parents(lv_obj_t *screen);
static void switch_page(String newPage, lv_obj_t *newScreen);
void reset_settings();
void add_text(String text[], bool clear_first);
static void processFrame();
void update_mode(int val);
void update_level(int val);
void update_speed(int val);
void update_beep(int val);
// 新增事件驱动接口声明
void on_encoder_click_event();
void on_encoder_double_click_event();

#endif //CHESSBOTBOARD_22_SCREEN_H


